﻿using ITSM.Model.Entity;
using ITSM.Model.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ITSM.Service
{
    public interface IDemand
    {
        /// <summary>
        /// 获取所有事件等级，按等级编号升序
        /// </summary>
        /// <returns></returns>
        List<M_DemandLevel> GetDemandLevels();
        /// <summary>
        /// 新增需求订单
        /// </summary>
        /// <param name="demand"></param>
        /// <returns>返回IT人员分配结果：IT人员ID</returns>
        string AddDemand(M_Demand demand);
        /// <summary>
        /// 新增需求订单2,重新发起
        /// </summary>
        /// <param name="demand"></param>
        /// <returns>返回IT人员分配结果：IT人员ID</returns>
        string AddDemand2(M_Demand demand);
        /// <summary>
        /// 获取订单数量
        /// </summary>
        /// <param name="demandList">查询条件</param>
        /// <returns>订单数量</returns>
        int[] DemandNum(M_DemandList demandList);

        /// <summary>
        /// 获取是否有其他公司的订单
        /// </summary>
        /// <param name="demandList"></param>
        /// <returns></returns>
        bool OtherCompanyDemandNum(M_DemandList demandList);

        /// <summary>
        /// 获取订单列表
        /// </summary>
        /// <param name="demandList">查询条件</param>
        /// <returns>订单列表</returns>
        M_DemandList DemandList(M_DemandList demandList);
        /// <summary>
        /// 获取订单详情
        /// </summary>
        /// <param name="RYD_DemandId">订单编号</param>
        /// <returns>需求订单详情，包括订单编号，不包括数据库记录ID</returns>
        M_DemandInfo DemandInfo(int RYD_DemandId);
        /// <summary>
        /// 根据传递过来的类别关联信息，返回相关人员的所有状态的订单数
        /// </summary>
        /// <param name="typeLinks">人员类别关联信息</param>
        /// <returns>相关人员的所有状态的订单数，包括人员编号，人员姓名</returns>
        List<M_TransferOrdersUsers>? GetUserState(List<RYD_DemandTypeLink> typeLinks);
        /// <summary>
        /// 根据传递过来的类别关联信息，返回需求订单分配的IT人员
        /// </summary>
        /// <param name="typeLinks">人员类别关联信息</param>
        /// <returns>返回IT人员分配结果：IT人员ID</returns>
        string AssignPersonnel(List<RYD_DemandTypeLink> typeLinks);

        /// <summary>
        /// 记录需求订单
        /// </summary>
        /// <param name="demand"></param>
        /// <returns></returns>
        bool RecordDemand(M_Demand demand);
        /// <summary>
        /// 修改订单级别
        /// </summary>
        /// <param name="rYD_DemandList"></param>
        /// <returns></returns>
        bool SetLevelOrder(RYD_DemandList rYD_DemandList);

        RYD_DemandList QueryLastDemand(string RYD_Id);
    }
}
